# Load google apps modules
import os
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.api import mail
from Functions import *


# PageMaker class implementation
class PageMaker(webapp.RequestHandler):
	def get(self):							
		# Get the page requested
		pages = ['home']	
		page = self.request.path[1:]
		if page == '':
			page = 'home'				
		
		if page in pages:				
			if page == 'home':
				# Output page content
				content = {'title': 'Joe Shaw Music',
							'content_file': 'pages/home.html'}
			
		else:
			# 404 error
			content = {'title': 'Joe Shaw Music - Page Not Found',
						'content_file': 'pages/404.html'}

		# Serve page
		path = os.path.join(os.path.dirname(__file__), 'shell.html')
		self.response.out.write(template.render(path, content))
		
	def post(self):
		get(self)